package util;
import java.sql.*;

public class Language {
	
	private static Connection conn = JdbcUtil.getConnection("decuries");
	
	static public String getString(String key, String lang){
		try {
			PreparedStatement stm = conn.prepareStatement("select config_string from languagestring where language_code=? and config_code=?");
			stm.setString(1, lang);
			stm.setString(2, key);
			ResultSet set = stm.executeQuery();
			if(set.next())
				return set.getString(1);
			else{
				Log.err2DB("没用找到对应的配置字符串:"+key, null,Log.LOGIC_ERROR, null);
				return "";
			}
		} catch (SQLException e) {
			Log.err2DB("sql语言出错：", e , Log.SQL_ERROR, null);
			System.out.println(e.getMessage());
			e.printStackTrace();
		}
		return null;
	}
}
